package com.service.impl;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Component;

import com.dao.impl.UserDaoImpl;
import com.interceptor.SysContent;
import com.model.Users;
import com.service.UserManager;

@Component("userManager")
public class UserManagerImpl implements UserManager {
	private UserDaoImpl userDaoImpl;

	public UserDaoImpl getUserDaoImpl() {
		return userDaoImpl;
	}

	@Resource
	public void setUserDaoImpl(UserDaoImpl userDaoImpl) {
		this.userDaoImpl = userDaoImpl;
	}

	public boolean checkUserLogin(Users user) {
		boolean flag = userDaoImpl.checkUserLogin(user);
		if (flag) {
			HttpSession session = SysContent.getSession();
			String username = user.getU_name();
			session.setAttribute("name", username);
		}
		return flag;
	}

}
